import React, { useState } from 'react';
import Sidebar from './Sidebar';

const AppLayout = ({ children }) => {
  const [sidebarOpen, setSidebarOpen] = useState(false);

  const toggleSidebar = () => {
    setSidebarOpen(prev => !prev);
  };

  return (
    <div className="min-h-screen bg-material-grey-50 flex">
      {/* 全局侧边栏 */}
      <Sidebar isOpen={sidebarOpen} onToggle={toggleSidebar} />
      
      {/* 主内容区域 */}
      <div className="flex-1 flex flex-col lg:ml-0">
        {children({ toggleSidebar })}
      </div>
    </div>
  );
};

export default AppLayout;
